<template>
  <transition name="fade">
    <div v-if="visible" class="alert-modal-overlay">
      <div class="alert-modal">
        <p class="modal-text">{{ message }}</p>
        <div class="actions">
          <button class="close-button" @click="close">确定</button>
        </div>
      </div>
    </div>
  </transition>
</template>

<script>
export default {
  props: {
    visible: {
      type: Boolean,
      required: true
    },
    message: {
      type: String,
      required: true
    }
  },
  methods: {
    close() {
      this.$emit('update:visible', false);
    }
  }
}
</script>

<style scoped>
.alert-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
}

.alert-modal {
  background: white;
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); /* Enhanced shadow for depth */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 30%;
  min-width: 300px;
  max-width: 500px;
  text-align: center;
  backdrop-filter: blur(10px);
}

.modal-text {
  font-size: 1.25rem;
  color: #333;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 20px;
  text-align: center;
}

.actions {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.close-button {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.3s;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close-button:hover {
  background-color: #45a07b;
  transform: translateY(-2px);
}

.close-button:focus {
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(76, 175, 80, 0.5);
}

.fade-enter-active, .fade-leave-active {
  transition: opacity 0.5s, transform 0.5s;
}

.fade-enter, .fade-leave-to {
  opacity: 0;
  transform: scale(1.05);
}
</style>